package fr.snac.serialization;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

import fr.snac.utils.Constants;
import fr.snac.utils.FilesUtil;

public class InfosSerializer {

	Infos infos;

	public InfosSerializer(Infos infos) {
		this.infos = infos;
	}
	
	public boolean serialize(){
		
		try {
			String filePath = FilesUtil.getPostFolderPath() + "/" + Constants.BM_FILENAME_INFOS + ".ser";
			FileOutputStream postFile = new FileOutputStream(filePath);
			ObjectOutputStream oos = new ObjectOutputStream(postFile);
			oos.writeObject(infos);
			oos.flush();
			oos.close();
			
			return true;
		} catch (IOException e) {
			return false;
		}
		
	}
	
}
